#include "HeadFile.h"

BaseWindow* WindowControl::screen = nullptr;
WindowControl* WindowControl::instance = nullptr;

WindowControl::WindowControl()
{
	screen = new MainMenu;
}

WindowControl::~WindowControl()
{
	if (screen)
		delete screen;
}

void WindowControl::Show()
{
	if(screen == nullptr)
		screen = new MainMenu;
	screen->Show();
}

void WindowControl::Update()
{
	screen->Update();
}

void WindowControl::Init()
{
	screen->Init();
}

void WindowControl::ChangeWindow(WindowType type, bool flag2, UserNode* uprt)
{
	if (screen)
	{
		delete screen;
		screen = Factory::Instance()->FCreateWindow(type, flag2, uprt);
	}
}

WindowControl * WindowControl::Instance()
{
	if (instance == nullptr)
	{
		instance = new WindowControl;
	}
	return instance;
}
